//
//  MainView.h
//  V3d_Cocoa
//
//  Created by Y my on 11-3-14.
//  Copyright 2011 NJUST. All rights reserved.
//


#import <UIKit/UIKit.h>
#import "Observer.h"
#import "My4DImage.h"
#import "MainViewData.h"
#import "Colormap.h"

#define MAX_DESP_WIDTH_PIXELS 750
#define MAX_DESP_HEIGHT_PIXELS 640
#define SPACE_PIXELS 20

typedef enum tagAxisCode {axis_x, axis_y, axis_z, axis_c} AxisCode;
typedef enum tagImageResamplingCode {PRS_Z_ONLY, PRS_X_ONLY, PRS_Y_ONLY, PRS_XY_SAME, PRS_XYZ_SAME} ImageResamplingCode;
typedef enum tagImageMaskingCode {IMC_XYZ_INTERSECT, IMC_XYZ_UNION, IMC_XY, IMC_YZ, IMC_XZ} ImageMaskingCode;

@interface MainView : UIView <Observer> {
	My4DImage* my4DImage;
	MainViewData* mainViewData;
	NSString *infoString;
	
	CGFloat disp_scale;
	BOOL b_displayFocusCrossLine;
	CGPoint curDisplayCenter;
    ImageDisplayColorType Ctype;
	CGFloat cur_focus_ratio;
	CGFloat zoom_scale;
	CGPoint translation;
	
	CGImageRef pixmap;
	
		
	//QPolygon roiPolygon;//061009
	//NSPoint curMousePos;
	//bool bMouseCurorIn;
	//NSPoint dragStartPosition;
	 
}

@property (assign) My4DImage* my4DImage;
@property (assign) MainViewData* mainViewData;

@property (copy) NSString *infoString;
//@property NSInteger disp_width, disp_height;
@property CGFloat disp_scale;

@property CGImageRef pixmap;

@property CGFloat zoom_scale;
@property CGPoint translation;

- (BOOL)translationEqual:(CGPoint)newtranslaton;

- (void)getSpecificData; // must be implemented by subclasses
- (NSInteger)focusPlaneCoord;

- (void)drawPixmapType:(CGContextRef)theContext;

- (BOOL)getFocusCrossLinePosWidth:(int*)focusPosInWidth andHeight:(int*)focusPosInHeight; // must be implemented by subclasses

- (BOOL)internal_only_imgplane_op;
- (CGImageRef)fillPixmapWithRawData_colormap:(unsigned char****)p4d
								 dtype:(ImagePixelType)dtype
								   sz0:(V3DLONG)sz0
								   sz1:(V3DLONG)sz1
								   sz2:(V3DLONG)sz2
								   sz3:(V3DLONG)sz3
							 cposRatio:(CGFloat)cposRatio
							  colorMap:(const ColorMap*)pc;   // must be implemented by subclasses
- (CGImageRef)fillPixmapWithRawData:(unsigned char****)p4d
						  sz0:(V3DLONG)sz0
						  sz1:(V3DLONG)sz1
						  sz2:(V3DLONG)sz2
						  sz3:(V3DLONG)sz3
						ctype:(ImageDisplayColorType)ctype
					cposRatio:(CGFloat)cposRatio
			 intensityRescale:(BOOL)bIntensityRescale
					   p_vmax:(double*)p_vmax
					   p_vmin:(double*)p_vmin;   // must be implemented by subclasses

//const QPolygon & getRoi() {return roiPolygon;}

//    - (void)resizeEvent(QResizeEvent *e);

//QLineEdit *textEditor; //080131

//- (void)mousePressEvent(QMouseEvent *e);
//- (void)mouseLeftButtonPressEvent(QMouseEvent *e);
//- (void)mouseRightButtonPressEvent(QMouseEvent *e);

//- (void)mouseDoubleClickEvent(QMouseEvent * e);
//- (void)mouseMoveEvent (QMouseEvent * e);
//- (void)enterEvent (QEvent * e);
//- (void)leaveEvent (QEvent * e);
//- (void)wheelEvent(QWheelEvent * e); //add this on 2008-01-10

//- (void)dragMoveEvent(QDragMoveEvent * e); //090212
//- (void)drawLookingGlassMap:(CGContextRef)theContext atPoint:(NSPoint*)curPt;
//- (void)drawSelectedLocations:(CGContextRef)theContext;/*QList <LocationSimple> *curList, QList <PtIndexAndParents> * curRelation*/;
//- (void)drawROI:(CGContextRef)theContext;
//- (NSRect)getRoiBoundingRect;
//- (void)deleteROI;

@end
